﻿#region Using directives
using Microsoft.VisualStudio.TestTools.UnitTesting;

using System.Collections.Generic;

using Weazel.Gezel.Model;
using Weazel.Gezel.Model.Errors;
using Weazel.Math;
#endregion

namespace Weazel.Gezel.Parser.Test.Expressions
{
  [TestClass]
  public class TestParseCastExpression
  {
    [TestMethod]
    public void TestParseCastExpression1()
    {
      Tokenizer t = new Tokenizer("(ns(4)) a");

      Expression e = ParseCastExpression.Parse(new Set<Token>(Token.Eof), t);

      // assert no errors
      Assert.AreEqual(0, t.Errors.Count);

      Assert.IsTrue(e is CastExpression);

      CastExpression ce = e as CastExpression;

      Assert.IsTrue(ce.Child is LeafExpression);
      Assert.AreEqual(4, ce.Width);
      Assert.IsFalse(ce.Signed);
    }
  }
}
